package com.example.ec.service.impl;

import com.example.ec.dao.GenericDao;
import com.example.ec.service.GenericService;

import java.io.Serializable;
import java.util.List;

public abstract class GenericServiceImpl<T extends Serializable, ID extends Number> implements GenericService<T, ID> {

    GenericDao<T, ID> genericDao;

    abstract void setGenericDao(GenericDao<T, ID> genericDao);

    @Override

    public void create(T t) {
        genericDao.create(t);

    }

    @Override
    public void removeById(ID id) {
        genericDao.removeById(id);

    }

    @Override
    public void modify(T t) {
        genericDao.modify(t);

    }

    @Override
    public T queryById(ID id) {
        return genericDao.queryById(id);
    }

    @Override
    public List<T> queryAll() {
        return genericDao.queryAll();
    }

    @Override
    public void create(String sqlId, Object parameter) {
        genericDao.create(sqlId, parameter);

    }

    @Override
    public void modify(String sqlId, Object parameter) {
        genericDao.modify(sqlId, parameter);

    }

    @Override
    public T queryOne(String sqlId, Object parameter) {
        return genericDao.queryOne(sqlId, parameter);
    }

    @Override
    public List<T> queryList(String sqlId, Object parameter) {
        return genericDao.queryList(sqlId, parameter);
    }

    @Override
    public Object query(String sqlId, Object parameter) {
        return genericDao.query(sqlId, parameter);
    }
}
